package com.ajk.server.utils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.ajk.server.exception.AjkException;
import com.ajk.server.exception.ErrorConstant;

public class ServiceAssert {
	private static Logger logger = LoggerFactory.getLogger(ServiceAssert.class);
	public static void notNull(Object object, String message) {
		if (object == null) {
			AjkException exception = new AjkException(ErrorConstant.OPERATION_ERROR.getErrorCode(),message);
			logger.warn(message,exception);
			throw exception;
		}
	}
	
	public static void throwException(String message) {
		AjkException exception = new AjkException(ErrorConstant.OPERATION_ERROR.getErrorCode(),message);
			logger.warn(message,exception);
			throw exception;
	}
	
	public static void throwException(Boolean condition,String message) {
		if(condition!=null && condition){
			throwException(message);
		}
	}
}